//
//  DXUtil.h
//  suremodv
//
//  Created by dd on 13-9-17.
//  Copyright (c) 2013年 xiaomuzhi. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <ifaddrs.h>
#import <arpa/inet.h>
#import "DX.h"

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

@interface DX (Util)

+ (NSURL *) urlOfImg:(NSString *)imageName;
+ (NSURL *) urlOfClientImg:(NSString *)imageName;

+ (void) alertWithTitle:(NSString *)title message:(NSString *)message delegate:(id<UIPickerViewDelegate>) delegate;
+ (void) alert:(NSString *)message delegate:(id<UIPickerViewDelegate>) delegate;
+ (void) alert:(NSString *)message;

+ (NSString *) time;
+ (NSString *) timeFormat:(NSString *)time;
+ (NSString *) timeFormat:(NSString *)time format:(NSString *)format;
+ (NSString *) integer2String:(int)i;
+ (NSNumber *) integer2Number:(int)i;
+ (UIColor *) colorWithRed:(int)red green:(int)green blue:(int)blue alpha:(float)alpha;
+ (UIColor *) colorWithHex:(NSString *)hexColor;
+ (NSString *)makeRandString:(int)length;
+ (NSString *)makePaySN;
+ (NSString *) md5:(NSString *)content;

+ (double) screenWidth;
+ (double) screenHeight;
+ (NSString *) IPAddress;

+ (NSString *)jsonEncode:(id)object;
+ (id)jsonDecode:(NSString *)jsonString;

+ (NSInteger) parseInteger:(id)content;
+ (float) parseFloat:(id)content;
+ (double) parseDouble:(id)content;

+ (BOOL)isNull:(id)object;
@end
